﻿/* PN264 - A Parallel H.264 Encoding Utility
 * Copyright © 2009 PN264 Development Team
 *
 * This software is released the terms and conditions of the MIT License,
 * a copy of which can be found in the License.txt file.
 *
 * Contributors:
 * Will 'AnarkiNet' Shelley (AnarkiNet@gmail.com)
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PN264
{
    /// <summary>
    /// Represents a processing task.
    /// </summary>
    public sealed class Task
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="Task"/> class.
        /// </summary>
        public Task()
        {
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Task"/> class.
        /// </summary>
        /// <param name="id"></param>
        public Task(long id)
        {
            this.id = id;
        }
        #endregion
        #region Fields
        private long id;
        private long jobId;
        private TaskStatus status;
        private DateTime startedAt;
        private TimeSpan elapsedTime;
        #endregion
        #region Properties
        /// <summary>
        /// Gets or sets the id of the current <see cref="Task"/>.
        /// </summary>
        public long Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }
        /// <summary>
        /// Gets or sets the id of the <see cref="Job"/> that owns the current <see cref="Task"/>.
        /// </summary>
        public long JobId
        {
            get
            {
                return this.jobId;
            }
            set
            {
                this.jobId = value;
            }
        }
        /// <summary>
        /// Gets or sets the <see cref="DateTime"/> that represents the point in time when the current <see cref="Task"/> was started.
        /// </summary>
        public DateTime StartedAt
        {
            get
            {
                return this.startedAt;
            }
            set
            {
                this.startedAt = value;
            }
        }
        /// <summary>
        /// Gets or sets the amount of time that the current <see cref="Task"/> has spent processing.
        /// </summary>
        /// <remarks>
        /// The elapsed time is not the time since the <see cref="Task"/> was started, rather, it represents only
        /// the time that the <see cref="Task"/> has been actively processing.
        /// </remarks>
        public TimeSpan ElapsedTime
        {
            get
            {
                return this.elapsedTime;
            }
            set
            {
                this.elapsedTime = value;
            }
        }
        /// <summary>
        /// Gets or sets the <see cref="TaskStatus"/> of the current <see cref="Task"/>.
        /// </summary>
        public TaskStatus Status
        {
            get
            {
                return this.status;
            }
            set
            {
                this.status = value;
            }
        }
        /// <summary>
        /// Gets a value that indicates the progress of the current <see cref="Task"/>, as a value from 0.0 to 100.0.
        /// If the <see cref="Task"/> is not being processed, a value of 0.0 is returned instead.
        /// </summary>
        public double Progress
        {
            get
            {
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Gets a <see cref="TimeSpan"/> that represents the estimated time remaining before the current <see cref="Task"/> is completed,
        /// calculated by using the elapsed time and the progress.
        /// </summary>
        public TimeSpan EstimatedTimeLeft
        {
            get
            {
                //TODO: Implement estimated time left algorithm using elapsed time and progress.
                throw new NotImplementedException();
            }
        }
        #endregion
    }
}
